function ToMarkDown(inputString) {
    const codeBlockRegex = /^ *```([^\n]*)\n([\s\S]*?^) *``` *$/gm;

    const inlineCodeRegex = /`([^`]+)`/g;
    let codeBlocks = [];

    inputString = inputString.replace(/</g, '&lt;').replace(/>/g, '&gt;');

    inputString = inputString.replace(codeBlockRegex, (match, language, code) => {
        const lines = code.split('\n');
        const minIndent = Math.min(...lines.filter(line => line.trim()).map(line => line.match(/^ */)[0].length));
        code = lines.map(line => line.slice(minIndent)).join('\n');
        codeBlocks.push({ language, code });
        return `{codeblock${codeBlocks.length - 1}}`;
    });

    inputString = inputString.replace(inlineCodeRegex, (match, code) => {
        return `<span class="inline-code">${code}</span>`;
    });

    codeBlocks.forEach((block, index) => {
        let { language, code } = block;

        let addedBlackBoxString =
            `<div class="code-wrapper">` +
                `<div class="code-header">` +
                    `<span class="language">${language}</span>` +
                    `<button class="copy-button" type="button">Copy code</button>` +
                `</div>` +

                `<div class="code-mainArea">` +
            `<code class="language-${language}" style="font-family: 'Courier New', Courier, monospace; font-size: 16px; line-height: 1.5; padding: 18px 0px 0px 0px;">` +
                        `${code}` +
                    `</code>` +
                `</div>` +
            `</div>`;


        inputString = inputString.replace(`{codeblock${index}}`, addedBlackBoxString);
    });

    return inputString
}
